#{extends 'mainStage.html' /}

#{set title:'Liste de vos candidatures' /}
    <h2 class="post-title">
                Liste de vos candidatures
            </h2>    
#{if attente}
    <div class="post">
        <div class="post">
            
            ${stage}
            <h3>Liste de vos candidatures en attente de validation ou en liste d'attente</h3>
            <table cellpadding="0" cellspacing="0" border="0" class="display"> 
        		<thead>
        			<tr>
        			    <th>Etat de votre candidature</th>
						<th>R&ocirc;le</th>
        				<th>Intitule</th>	
        				<th>Dur&eacute;e</th>
        				<th>Lieu</th>
						<th>Date de D&eacute;but</th>
        				<th>Etat du stage</th>
        				<th>Demande Annulation</th>			
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:attente, as:'candidature' }
        	       <tr>
        	           
        	           <td> 
                           <a href="@{candidats.detailCandid(candidature.id)}">${candidature.etatCandid}</a>
       	               </td>
       	               
			           <td> 
                           ${candidature.role.nom}
       	               </td>

        	            <td> 
                            #{if candidature.getStage()!=null}
                            	<a href="@{Stages.detailStage(candidature.stage.id)}">${candidature.stage.intitule}</a>
                            #{/if}
                            #{else}
                            	${candidature.intitule}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.getStage()!=null}
                            	${candidature.stage.duree}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
       	            
       	                <td> 
       	                	#{if candidature.getStage()!=null}
								#{if candidature.stage.cis == null}
									-
								#{/if}
								#{else}
									${candidature.stage.cis}
								#{/else}
							#{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td> 
                            #{if candidature.getStage()!=null}
	                            #{if candidature.stage.dateDeb == null}
	                                -
	        	                #{/if}
	                            #{else}
	        	                    ${candidature.stage.dateDeb.format('dd MMMM yyyy', 'fr')}
	                            #{/else}
                            #{/if}
                             #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	           <td> 
        	                #{if candidature.getStage()!=null}
                            	${candidature.stage.etat}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td>
            	            #{if candidature.candidature_non_annuler == true}
            	                Annulation refus&eacute;e
            	            #{/if}
            	            #{elseif candidature.etatCandid.nom=="Annul&acute;e"}
            	                -
           	                #{/elseif}
           	                #{else}
        	                    <a href="@{Candidats.demandeAnnulation(candidature.id)}">Demande d'annulation</a>
            	            #{/else}
        	            </td>
        	       </tr>
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}
#{if valide}
    <div class="post">
        <div class="post">
            <h3>Liste de vos candidatures valid&eacute;es</h3>
            <table cellpadding="0" cellspacing="0" border="0" class="display"> 
        		<thead>
        			<tr>
        			    <th>Etat de votre candidature</th>
					<th>R&ocirc;le</th>
        				<th>Intitule</th>	
        				<th>Dur&eacute;e</th>
        				<th>Lieu</th>
						<th>Code stage</th>
        				<th>Date de D&eacute;but</th>
        				<th>Etat du stage</th>
        				<th>Demande Annulation</th>			
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:valide, as:'candidature' }
        	       <tr>
        	           
        	           <td> 
                           <a href="@{candidats.detailCandid(candidature.id)}">${candidature.etatCandid}</a>
       	               </td>
       	               
			           <td> 
                           ${candidature.role.nom}
       	               </td>

        	            <td> 
                            #{if candidature.getStage()!=null}
                            	<a href="@{Stages.detailStage(candidature.stage.id)}">${candidature.stage.intitule}</a>
                            #{/if}
                            #{else}
                            	${candidature.intitule}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.getStage()!=null}
                            	${candidature.stage.duree}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	                <td> 
                            #{if candidature.getStage()!=null}
								#{if candidature.stage.cis == null}
									-
								#{/if}
								#{else}
									${candidature.stage.cis}
								#{/else}
							#{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td>
							#{if candidature.getStage()!=null}
                            	${candidature.getStage().getCode()}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
						</td>
        	            <td> 
                            #{if candidature.getStage()!=null}
	                            #{if candidature.stage.dateDeb == null}
	                                -
	        	                #{/if}
	                            #{else}
	        	                    ${candidature.stage.dateDeb.format('dd MMMM yyyy', 'fr')}
	                            #{/else}
                            #{/if}
                             #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	            <td> 
        	                #{if candidature.getStage()!=null}
                            	${candidature.stage.etat}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td>
            	            #{if candidature.candidature_non_annuler == true}
            	                Annulation refus&eacute;e
            	            #{/if}
            	            #{elseif candidature.etatCandid.nom.equals("Annul&eacute;e")}
            	                -
            	            #{/elseif}
            	            #{else}
        	                    <a href="@{Candidats.demandeAnnulation(candidature.id)}">Demande d'annulation</a>
            	            #{/else}
            	        </td>
        	       </tr>
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}

#{if refus}
    <div class="post">
        <div class="post">
            <h3>Liste de vos candidatures refus&eacute;es</h3>
            <table cellpadding="0" cellspacing="0" border="0" class="display"> 
        		<thead>
        			<tr>
        			    <th>Etat de votre candidature</th>
					<th>R&ocirc;le</th>
        				<th>Intitule</th>	
        				<th>Dur&eacute;e</th>
        				<th>Lieu</th>
						<th>Date de D&eacute;but</th>
        				<th>Etat du stage</th>
        				<th>Motif refus</th>			
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:refus, as:'candidature' }
        	       <tr>
        	           
        	           <td> 
                           <a href="@{candidats.detailCandid(candidature.id)}">${candidature.etatCandid}</a>
       	               </td>
       	               
			           <td> 
                           ${candidature.role.nom}
       	               </td>

        	            <td> 
                            #{if candidature.getStage()!=null}
                            	<a href="@{Stages.detailStage(candidature.stage.id)}">${candidature.stage.intitule}</a>
                            #{/if}
                            #{else}
                            	${candidature.intitule}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.getStage()!=null}
                            	${candidature.stage.duree}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	                <td> 
                            #{if candidature.getStage()!=null}
								#{if candidature.stage.cis == null}
									-
								#{/if}
								#{else}
									${candidature.stage.cis}
								#{/else}
							#{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td> 
                            #{if candidature.getStage()!=null}
	                            #{if candidature.stage.dateDeb == null}
	                                -
	        	                #{/if}
	                            #{else}
	        	                    ${candidature.stage.dateDeb.format('dd MMMM yyyy', 'fr')}
	                            #{/else}
                            #{/if}
                             #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	            <td> 
        	                #{if candidature.getStage()!=null}
                            	${candidature.stage.etat}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td>
            	            ${candidature.motifRefus}
            	        </td>
        	       </tr>
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}

#{if annulee}
    <div class="post">
        <div class="post">
            <h3>Liste de vos candidatures annul&eacute;es</h3>
            <table cellpadding="0" cellspacing="0" border="0" class="display"> 
        		<thead>
        			<tr>
        			    <th>Etat de votre candidature</th>
						<th>R&ocirc;le</th>
        				<th>Intitule</th>	
        				<th>Dur&eacute;e</th>
        				<th>Lieu</th>
						<th>Date de D&eacute;but</th>
        				<th>Etat du stage</th>
        				<th>Raison de l'annulation</th>			
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:annulee, as:'candidature' }
        	       <tr>
        	           
        	           <td> 
                           <a href="@{candidats.detailCandid(candidature.id)}">${candidature.etatCandid}</a>
       	               </td>
       	               
			           <td> 
                           ${candidature.role.nom}
       	               </td>

        	            <td> 
                            #{if candidature.getStage()!=null}
                            	<a href="@{Stages.detailStage(candidature.stage.id)}">${candidature.stage.intitule}</a>
                            #{/if}
                            #{else}
                            	${candidature.intitule}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if candidature.getStage()!=null}
                            	${candidature.stage.duree}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	                <td> 
                            #{if candidature.getStage()!=null}
								#{if candidature.stage.cis == null}
									-
								#{/if}
								#{else}
									${candidature.stage.cis}
								#{/else}
							#{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td> 
                            #{if candidature.getStage()!=null}
	                            #{if candidature.stage.dateDeb == null}
	                                -
	        	                #{/if}
	                            #{else}
	        	                    ${candidature.stage.dateDeb.format('dd MMMM yyyy', 'fr')}
	                            #{/else}
                            #{/if}
                             #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            
        	           <td> 
        	                #{if candidature.getStage()!=null}
                            	${candidature.stage.etat}
                            #{/if}
                            #{else}
                            	Stage non planifi&eacute;
                            #{/else}
        	            </td>
        	            <td>
       	                    ${candidature.motifAnnulation}
            	        </td>
        	       </tr>
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}